package www.albertzhe.askForLeave.responsibility;

import www.albertzhe.askForLeave.Chain;
import www.albertzhe.askForLeave.Ratify;
import www.albertzhe.askForLeave.impl.Request;
import www.albertzhe.askForLeave.impl.Result;

/**
 * 经理（级别中等）
 */
public class Manager implements Ratify {

    @Override
    public Result deal(Chain chain) {
        Request request = chain.request();
        System.out.println("“经理” 正在查看请求：" + request.toString());
        
        if (request.getDays() > 4) {
            // 构建新的 Request
            request.setManagerInfo(request.getName() + "每月的KPI考核还不错，可以批准");
            return chain.proceed(request);
        }
        return new Result(true, "Manager：早点把事情办完，项目离不开你");
    }
}
